<?php
echo $this->render('picture/photo/_tab.phtml');
$this->headScript()->appendFile(_STATIC_HTTP . '/admin/js/_ajax.js');
?>
<?php $this->headStyle()->captureStart();?>
td.icon a {width:120px;height:160px;}
td.icon a img {max-width:120px;min-width:120px;}
<?php $this->headStyle()->captureEnd();?>
<?php $this->headScript()->captureStart();?>
$(document).ready(function(){
	_ajax.id = $('#special-list');
	_ajax.form = $('form.ajaxForm');
	_ajax.name = 'special';
	_ajax.loading = $('#special-list').html();
	_ajax.url = '<?php echo $this->url('picture/ajax/addPhotoToSpecial');?>';
	_ajax.load();
});
<?php $this->headScript()->captureEnd();?>
<form action="" method="post" class="ajaxForm">
<?php
echo $this->form()->hidden('referer', $this->referer);
echo $this->form()->hidden('addTo', '1') . "\n";
?>
<div class="body">
	<table class="search form">
		<tr>
			<th style="width:360px;"><?php echo $this->language('Selected Photos');?></th>
			<th><?php echo $this->language('Specials');?></th>
			<th style="width:300px;"><?php echo $this->language('Add Photo(s) To Special');?></th>
		</tr>
		<tr>
			<td>
				<table class="form no-border">
					<tr>
					<?php 
					$count = count($this->photos);
					$key = 1;
					foreach($this->photos AS $row) {
					?>
						<td class="icon">
							<div style="float:left;position:relative;">
							<a href="<?php echo $row->getImage()->getLarge(false);?>" target="_blank" style="float:left;">
							<img src="<?php echo $row->getImage()->getThumb(false);?>" />
							</a>
							<span style="position:absolute;left:1px;top:1px;padding:1px;background:#fff;">
							<input type="checkbox" name="photo_id[]" id="id-<?php echo $row->getId();?>" value="<?php echo $row->getId();?>" checked="checked" />
							</span>
							</div>
						</td>
					<?php
						if($key % 3 == 0 && $key < $count) {
							echo '</tr><tr>';
						}
						$key ++;
					}
					for($i = 0; $i < ((3 - $count % 3) % 3); $i ++) {
						echo '<td style="width:' . intval(100/3) . '%">&nbsp;</td>';
					}		
					?>
					</tr>
				</table>
			</td>
			<td>
				<div class="search left" style="padding:2px 3px;">	
					<span><?php echo $this->partial('picture/_inc/categorySelect.phtml', array('name' => 'category_id'));?></span>
					<span><?php echo $this->render('include/searchInput.phtml');?></span>
					<span><button type="button" value="Search" onclick="_ajax.load();">Search</button></span>
				</div>
				<hr/>
				<div id="special-list" class="center">
					<h1 style="padding:10px;"><?php echo $this->language('Loading')?>...</h1>
				</div>
			</td>
			<td><select name="special_id[]" id="special-id-x" style="width:100%;height:400px;" multiple="multiple"><?php 
			foreach($this->specialList AS $special) {
				echo '<option value="' . $special->getId() . '" selected="selected">';
				echo $special->getTitle() . '[' . $special->getName() . '][' . $special->getPtotal() . ']</option>';
			}
			?></select></td>
		</tr>
		<tr>
			<th colspan="3">
				<button type="submit" name="addToSpecial" value="submit"><?php echo $this->language('Continue');?> »</button>
				<button type="button" name="cancel" value="cancel" onclick="history.back();"><?php echo $this->language('Cancel');?> »</button>
			</th>
		</tr>
	</table>
</div>
</form>
